package com.iodemo;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class InputStreamTest {
    public static void main(String[] args) {
        InputStream is = null;
        try {
            is = new FileInputStream("/Users/edy/Desktop/file/1.txt");
            byte[] bytes = new byte[50];
            int len;
            while ((len = is.read(bytes)) > 0) {
                System.out.println(new String(bytes,0,len));
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
          IOUntilsDemo.close(is);
        }
    }

}
